<?php if (!defined('SERVER_ROOT')) { exit('No direct script access allowed');}
$this->template->title = 'Hệ thống hỗ trợ công tác quản lý cán bộ trường ĐHTG';
$v_pop_win = isset($_REQUEST['pop_win']) ? '_pop_win' : '';
$this->template->display('dsp_header' . $v_pop_win . '.php');
//------------------------------------------------------------------------------
$MA_CAN_BO ='';
$TEN_HOC_KY = Session::get(TIEP_DAU_NGU_SESSION.'HOC_KY_HIEN_TAI');
$MA_LOAI_NCKH ='';
$TEN_NCKH ='';
$CAP_BAC = '';
$SO_TIEN = '';
while ($arr = $arr_single_nckh->FetchRow()){
    $MA_CAN_BO =$arr['MA_CAN_BO'];
    $TEN_HOC_KY = $arr['TEN_HOC_KY'];
    $MA_LOAI_NCKH =$arr['MA_LOAI_NCKH'];
    $TEN_NCKH =$arr['TEN_NCKH'];
    $CAP_BAC = $arr['CAP_BAC'];
    $SO_TIEN = $arr['SO_TIEN'];
}
?>
<form name="frmMain" method="post" id="frmMain" action=""><?php
    echo $this->hidden('controller', $this->get_controller_url());
    echo $this->hidden('hdn_dsp_single_method', 'dsp_single_nckh');
    echo $this->hidden('hdn_dsp_all_method', 'dsp_all_nckh');
    echo $this->hidden('hdn_update_method', 'update_nckh');
    echo $this->hidden('hdn_delete_method', 'delete_nckh');
    echo $this->hidden('hdn_item_id', $TEN_NCKH);
    echo $this->hidden('hdn_macanbo', $var_macanbo);
    if ($TEN_NCKH == '') {
         echo $this->hidden('hdn_update_type', 'THEM_MOI');
    }else{
         echo $this->hidden('hdn_update_type', 'CAP_NHAT');
    }
    echo $this->hidden('pop_win', $v_pop_win);
    ?>
    <h4 style="text-align: center">Cập nhật NCKH - <?php echo $var_tencanbo;?></h4>
    <div class="Row">
        <div class="left-Col">Học kỳ <label class="required">(*)</label> </div>
        <div class="right-Col">
            <input type="text" name="txt_TEN_HOC_KY" id="txt_TEN_HOC_KY" value="<?php echo $TEN_HOC_KY; ?>"
                   class="inputbox" maxlength="255" style="width:95%"
                   onKeyDown="return handleEnter(this, event);"
                   data-allownull="no" data-validate="text"
                   data-name="học kỳ"
                   data-xml="no" data-doc="no"
                   readonly="readonly"
            />
        </div>
    </div>
    <div class="Row">
        <div class="left-Col">Loại NCKH <label class="required">(*)</label></div>
        <div class="right-Col">
            <select id="cbx_MA_LOAI_NCKH"  name="cbx_MA_LOAI_NCKH" style="width:96%">
                  <?php while ($arr = $arr_all_loainckh->FetchRow()): ?>
                  <?php
                   $MA=$arr['MA_LOAI_NCKH'];
                   $TEN=$arr['TEN_LOAI_NCKH'];
                  ?>
                   <?php if($MA_LOAI_NCKH == $MA):?>
                     <option value="<?php echo $MA; ?>" selected="selected"><?php echo $TEN; ?></option>
                  <?php else:?>
                     <option value="<?php echo $MA; ?>" ><?php echo $TEN; ?></option>
                  <?php endif ?>
        <?php endwhile; ?>
            </select>
        </div>
    </div>
    <div class="Row">
        <div class="left-Col">Tên NCKH <label class="required">(*)</label> </div>
        <div class="right-Col">
              <input  type="text" name="txt_TEN_NCKH" id="txt_TEN_NCKH" value="<?php echo $TEN_NCKH; ?>"
                   class="inputbox" maxlength="255" style="width:95%"
                   onKeyDown="return handleEnter(this, event);"
                   data-allownull="no" data-validate="text"
                   data-name="tên NCKH"
                   data-xml="no" data-doc="no"
                  <?php if($TEN_NCKH != ''):?>
                      readonly="readonly"
                  <?php else:?>
                      autofocus="autofocus"
                  <?php endif ?>
            />

        </div>
    </div>
    <div class="Row">
        <div class="left-Col">Cấp bậc</div>
        <div class="right-Col">
            <input type="text" id="txt_CAP_BAC"  name="txt_CAP_BAC" value="<?php echo $CAP_BAC; ?>"
                   class="inputbox" size="4" maxlength="300" style="width:95%"
                   data-allownull="no"
                   data-name="thứ tự hiển thị"
                   data-xml="no" data-doc="no"
             />
        </div>
    </div>
    <div class="Row">
        <div class="left-Col">Số tiền</div>
        <div class="right-Col">
            <input type="text" id="txt_SO_TIEN"  name="txt_SO_TIEN" value="<?php echo $SO_TIEN; ?>"
                   class="inputbox" size="4" maxlength="300" style="width:95%"
                   data-allownull="no"
                   data-name="thứ tự hiển thị"
                   data-xml="no" data-doc="no"
             />
        </div>
    </div>
    <div class="button-area">
        <input type="button" name="update" class = 'button save' value="Cập nhật" onclick="btn_update_onclick();"/>
        <?php $v_back_action = ($v_pop_win === '') ? 'btn_back_onclick();' : 'try{window.parent.hidePopWin();}catch(e){window.close();};';?>
        <input type="button" name="cancel" class = 'button close' value="Bỏ qua" onclick="<?php echo $v_back_action;?>"/>
    </div>

</form>
<?php $this->template->display('dsp_footer' .$v_pop_win . '.php');